package com.mz.ozy.mvp.model;


import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;

import com.mz.ozy.constants.Constants;
import com.mz.ozy.net.RetrofitUtils;
import com.mz.ozy.utils.JsonUtils;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

/**
 * @author
 * @date 2018/7/25
 * @description
 */
public class BookDetailModel {


    public Observable<ResponseBody> geAssetsInfo(Context context, String city, String address) {
        Map<String, String> maps = new HashMap<>();
        maps.put("city", city);
        maps.put("area", address);
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10087, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

    public Observable<ResponseBody> getInfo(Activity activity, String city, String area, String id, String gid) {
        Map<String, String> maps = new HashMap<>();
        maps.put("city", city);
        maps.put("area", area);
        maps.put("id", id);
        maps.put("attribute_id", gid);
        return RetrofitUtils.getApiService(activity).post(Constants.TransCode.TransCode10092, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }

    public Observable<ResponseBody> onBookPrivate(Context context, String id, String attribute_id, String cardid, String cid, String bid, String yman, String mealdata, String mealtime, String gender, String realName, String phone, String remark) {
        Map<String, String> maps = new HashMap<>();
        maps.put("id", id);
        maps.put("attribute_id", attribute_id);
        if (!TextUtils.isEmpty(cardid)) {
            maps.put("cardid", cardid);
        }
        maps.put("cid", cid);
        maps.put("bid", bid);
        maps.put("yman", yman);
        maps.put("mealdata", mealdata);
        maps.put("mealtime", mealtime);
        maps.put("gender", gender);
        maps.put("name", realName);
        maps.put("phone", phone);
        if (!TextUtils.isEmpty(remark)) {
            maps.put("remark", remark);
        }
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10093, JsonUtils.requestJsonDate(maps), Constants.tokenId);

    }
}
